xml

Convert String XML fragment to Document Node in Java

In Java how can you convert a String that represents a fragment of XML for insertion into an XML document? e.g. String newNode = "<node>value</node>"; // Convert this to XML Then insert this node into an org.w3c.dom.Document at as the child of a given node? ...

JQuery not working in IE

I am trying to create a dynamic menu by reading an xml file using jQuery. I have developed the code and its been working fine in FF3 and Chrome, however it just doesn't work for IE7/8. Im posting my code below, can some one please have a look and help me with this ? var menu =""; $(document).ready(function() { $.ajax({ ...

Struts2, best practice for using method={1}

I'm new to Struts 2 and I've come across this syntax (recommended in the tutorial). <action name="Register_*" method="{1}" class="Register"> <result name="input">/member/Register.jsp</result> <result type="redirectAction">Menu</result> </action> I understand that it calls Register.{1} method. The problem is a user could put in...

Parsing XML contained in a string using an XSL via JQuery

This is my XML: var x="<page><item>1</item></page>"; My XML is stored in a JavaScript string. I am trying to make some changes to this XML using XSL. I want to apply this XSL to this XML via JavaScript. So I have used JQuery: $('#output').xslt({xmlURL: '??',xslUrl: 'Test.xsl'}); Here the xmlURL is an XML file, but the input is a s...

Invalid Characters in XML

Hey all, I am working with some XML at the moment. I have nodes that hold strings like below: <node>This is a string</node> Some of the strings that I am passing to the nodes will have characters like &, #, $ etc. <node>This is a string & so is this</node> This is not valid due to the & I cannot wrap these strings in CDATA as th...

Updating backend database from cooked XML/PDF input: Which is the best tool/approach?

We have to automate database updation couple of times a month. My current use case is as follows. Currently we manually diff the input data with the previous month's input. If it is XML we use MS xmldiff. If it is Pdf , it is fully done through manual verificaton :-( . Once the changes are found, we update the database through a fo...

Best way to do arrays in gsoap, considering WSDL compliance and performance

I'm using gsoap to generate an XML SOAP parser and WSDL grammar, and was wondering what is the recommended way to express a static array that is both fast to parse and generates a corresponding WSDL that passes all the validation tests (like Eclipse WSDL Validator or NetBeans Validate XML). If I use this input into gsoap: struct ns__Ar...

Well formed XML? XML references within tag names and attribute names

I have been searching trying to confirm my reading of the XML spec. My interpretation is that pre-defined entities and numeric character references are not allowed in tag names and attribute names, for example this is not allowed by the XML 1.0 spec.: <root> <test&apos;&#x27;&#39;tag test&apos;&#x27;&#39;attribute="one"/> </root> How...

XPathDocument Threading Question

I have a web application where I am trying to cache an XPathDocument. The XPathDocument is created as follows. XPathDocument xdoc = new XPathDocument(new StringReader(ruleXml)); Then I want to just cache this xdoc and retrieve it for each request. And then I plan to call XPathNavigator nav = xdoc.CreateNavigator(); on...

Saving a IXMLDOMDocument without end tag

Using MSXML via C++, when I call IXMLDOMDocument::save, empty XML elements will get an end tag, like this: <root> <child name="first"> </child> </root> But I want it saved as this: <root> <child name="first" /> </root> What do I need to do to accomplish that? ...

Partial bean serialization and deserialization+merging

Hi! I am developing a RESTful web service. I have a bunch of entity classes (mostly JPA entities, but also other beans). There are gazillions of object mapping, serialization, binding and whatnot libraries out there. I'm looking for a one that will enable me to: Serialize the entities to XML and JSON Serialization MUST support usin...

Parsing multiple XML feeds with PHP into one sorted array

I want to create a sortable list that looks something like $VAR1[0], $VAR2[0]... $VAR1[1], $VAR2[1]... The data comes from multiple same structured xml files: $xmlfile=" <Level1> <Level2> <Level2Item VAR1="1" VAR2="2" ... /> <Level2Item VAR1="4" VAR2="5" ... /> <Level2Item VAR1="7" VAR2="8" ... /> </Level2> </Level1>"; //Ex...

Converting from String to <T>

I really should be able to get this, but I'm just to the point where I think it'd be easier to ask. In the C# function: public static T GetValue<T>(String value) where T:new() { //Magic happens here } What's a good implementation for the magic? The idea behind this is that I have xml to parse and the desired values are often primi...

externalizing junit stub objects.

Hi!    In my project we created stub files for testing junits in java(factories) itself. However, we have to externalize these stubs. After seeing a number of serializers/deserializers, we settled on using XStream to serialize and deserialize these stub objects. XStream works like a charm. Its pretty good at what it claims to be. Previ...

How do I loop backwards from SiteMap.CurrentNode to SiteMap.RootNode

I have a simple Sitemap like this from asp:SiteMapDataSource: Page 1 > Page 2 > Page 3 I would like to create foreach loop in C# that generates it instead for using asp:SiteMapPath because I need to add some exceptions to it. Now I cannot figure out how do I loop backwards from SiteMap.CurrentNode to SiteMap.RootNode? ...

Emded XHTML snippet in XML document, and validate against a schema

Essentially I want to embed some XHTML in an XML document that must validate against a custom schema. Full background: I have a webservice that consumes an XML document. This XML document is validated against a custom schema. The data in the XML is parsed and stored in a database, and displayed in a useful format on a website. The cus...

What role does XML play in modern nTier architectures?

I have seen a lot of job postings for ASP.NET and server engineer positions, and they always seem to list XML and XSLT as one of the skills that is valuable to them. I am wondering what role XML plays in modern systems. How are people using XSLT with XML in nTier systems? ...

How can I use sp_xml_preparedocument on result of NTEXT query in SQL 2000?

I know NTEXT is going away and that there are larger best-practices issues here (like storing XML in an NTEXT column), but I have a table containing XML from which I need to pluck a attribute value. This should be easy to do using sp_xml_preparedocument but is made more tricky by the fact that you cannot declare a local variable of type ...

Sql Server 2005 Xml data type has CDATA removed on INSERT

I have the following table in my database: CREATE TABLE [dbo].[XmlData]( [id] [int] IDENTITY(1,1) NOT NULL, [xmldata] [xml] NOT NULL, CONSTRAINT [PK_XmlData] PRIMARY KEY CLUSTERED ( [id] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMA...

What is the best way to convert a java object to xml with open source apis

Hi, I was wondering what the best or most widely used apis are to convert a java object to xml. I'm fairly new on the subject. Is there some sort of api call you can make to pass in an object and return xml? Or is it much more tedious where as you need to construct the document manually by pulling out object values? I have been readi...