Mule ESB: Issue w/ XML generated from MapsToXML input to DataMapper - mule

I have a JDBC outbound endpoint that after performing Map To XML transformation, gives out XML in the following format:
<?xml version="1.0" encoding="UTF-8"?>
<table>
<record>
<field name="DESTINATION" type="java.lang.String">SFO</field>
<field name="PRICE" type="java.lang.String">500</field>
<field name="ID" type="java.lang.Integer">2</field>
</record>
</table>
The problem is that when I try to generate the schema for this XML for use in the datamapper , the fields that are generated from this are not usable (it only shows field , In the mapping file I get this message when I try to hover over it :
'The attribute cannot be dragged since it does not belong to 'Current Element Mapping'
How do I use my XML so that I can map those fields to either another CSV, database or some other entity?

Why not trying to map (via DataMapper) Map object directly to CSV or anything you'd like ? If you need this intermediary XML format, you can also use DataMapper for the initial Map->XML mapping and configure the way you want it to look like (instead using MapsToXML).

Related

Content Type Instantiation: Picking value of a reference field

I'm trying sensenet features, my focus is on reference field inside content type.
I defined & installed the following content type successfully.
<?xml version="1.0" encoding="utf-8"?>
<ContentType name="EmployeeCT" parentType="GenericContent"handler="SenseNet.ContentRepository.GenericContent" xmlns="http://schemas.sensenet.com/SenseNet/ContentRepository/ContentTypeDefinition">
<DisplayName>Employee Record</DisplayName>
<Description></Description>
<Icon>Content</Icon>
<AllowIncrementalNaming>true</AllowIncrementalNaming>
<AllowedChildTypes>EmployeeCT</AllowedChildTypes>
<Fields>
<Field name="Manager" type="Reference">
<DisplayName>Manager</DisplayName>
<Description></Description>
<Configuration>
<AllowMultiple>false</AllowMultiple>
<AllowedTypes>
<Type>EmployeeCT</Type>
</AllowedTypes>
<SelectionRoot>
<Path>/Root</Path>
</SelectionRoot>
<!--<DefaultValue>/Root/Path1,/Root/Path2</DefaultValue>-->
<ReadOnly>false</ReadOnly>
<Compulsory>false</Compulsory>
<VisibleBrowse>Show</VisibleBrowse>
<VisibleEdit>Show</VisibleEdit>
<VisibleNew>Show</VisibleNew>
</Configuration>
</Field>
</Fields>
</ContentType>
The problem is that I could not found & pick manager of employee.
Any help please,
Thanks.
Are there any previously saved content with the type EmployeeCT? Because you set it as the only allowed type as the value of the Manager field.
I've checked your code on my local site and it works. First I had to save an Employee Record to create a content for a manager and then I was able to pick it as a manager of a new Employee Record.

Extracting sql from SSRS Reports

I am trying to extract the sql from all my SSRS reports so I can see what database tables and columsn are used . Does anyone know how to do this if you have 50 reports ? Is there any exsiting functionality I have overlooked that does this ?
The RDL files are simple XML files. You could create a simple parser that extracts the information you want. If you don't have access to the RDL files right now, you can download them through the SSRS web interface.
Here's an excerpt of the relevant part of an RDL file:
<DataSets>
<DataSet Name="Test">
<Fields>
<Field Name="Testfield">
<DataField>Testfield</DataField>
<rd:TypeName>System.DateTime</rd:TypeName>
</Field>
</Fields>
<Query>
<DataSourceName>MyDataSource</DataSourceName>
<CommandType>StoredProcedure</CommandType>
<CommandText>spMyGreatStoredProcedure</CommandText>
<QueryParameters>
<QueryParameter Name="#param1">
<Value>=Parameters!Param1.Value</Value>
</QueryParameter>
<QueryParameter Name="#param2">
<Value>=Parameters!Param2.Value</Value>
</QueryParameter>
<rd:UseGenericDesigner>true</rd:UseGenericDesigner>
</Query>
</DataSet>
</DataSets>
There are one or more DataSet blocks, which define one data set of the report. First, all the fields are defined and then the query with its parameters.

What is the easiest way to generate a Lucene.NET synonym list XML?

What is the easiest way to generate a synonym list XML for use in Lucene.NET? From what I've read, Lucene.NET will load an XML document such as this format:
<?xml version="1.0" encoding="utf-8" ?>
<synonyms>
<group>
<syn>fast</syn>
<syn>quick</syn>
<syn>rapid</syn>
</group>
<group>
<syn>slow</syn>
<syn>decrease</syn>
</group>
<group>
<syn>google</syn>
<syn>search</syn>
</group>
<group>
<syn>check</syn>
<syn>lookup</syn>
<syn>look</syn>
</group>
</synonyms>
I've tried search for a tool that would take say a CSV and spit out an XML document in the correct format. However, I was surprised not to find anything. So either my understanding is incorrect and an XML document like the above isn't the way to load synonyms in Lucene.net, or I'm not searching correctly.
Any help would be appreciated.
Your xml comes from a CodeProject article, Lucene.Net - Custom Synonym Analyzer, which also includes a XmlSynonymEngine to parse your xml. You could build a custom ISynonymEngine to parse your csv data directly without converting your input to xml.

How to display the response format in xml in wcf?

i am getting the output as
<id>1</id>
<name>tt</name>
but i need to display the output as
<record>
<id>1</id>
<name>tt</name>
</record>
<record>
<id>2</id>
<name>te</name>
</record>
how to acheive this?
To structure your response message as you've shown above, create a data contract class named record. Then, in your record class, create properties for id and name. Finally, have your service operation return an array or List of your record class.

Parsing using NSXMLParser

I am being returned some XML from a web service. Basically, the xml looks like this:
<response>
<data>
More XML here but the it's escaped by XML entities
</data>
</response>
so, as you can see, I have xml that is valid, but the stuff inside data tag is escaped with XML entities. what's the best (most efficient) way for me to feed this into the parser?
What I am doing right now is, when I get the data from web service, I convert it into NSString....then replace the "XML escaped entities" with real ones.....then convert it back into NSData...then feed it into the parser. This doesn't seem like a very good solution so I was wondering if there's a better way to do it?
Thanks.
Alright, here's the xml that I am getting:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Header><ActivityId CorrelationId="d39007b5-ee69-41c7-a61d-831b456f9ea3" xmlns="http://schemas.microsoft.com/2004/09/ServiceModel/Diagnostics">aa88d1cd-253c-48d1-abeb-62a880bea806</ActivityId></s:Header><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><LoginResponse xmlns="http://MSS"><LoginResult><LoginInformation>
<User>
<UserID>612</UserID>
<UserName>Demo User</UserName>
<Email>mssdev#mss-mail.com</Email>
<CompanyID>17034</CompanyID>
<CompanyName>PlanET Demonstration Agency</CompanyName>
</User>
</LoginInformation></LoginResult></LoginResponse></s:Body></s:Envelope>
As you can see, everything in is escaped.
That's kind of horrifying. Why don't you just take the contents of that tag (e.g. the data with the entities) and just pass that through another NSXMLParser? The first parser will have decoded the entities, and the second parser will be presented with the decoded version of the contents of that tag.