Category Archives: Xml

T-SQL XML get a value from a node problem?

Questions: I have an XML like: <?xml version=”1.0″ encoding=”utf-16″?> <ExportProjectDetailsMessage xmlns:i=”http://www.w3.org/2001/XMLSchema-instance” xmlns=”http://schemas.datacontract.org/2004/07/Project”> <CPProjectId>7665699f-6772-424c-8b7b-405b9220a8e7</CPProjectId> </ExportProjectDetailsMessage> I’m trying to get the CPProjectId as a Uniqueidentifier using: DECLARE @myDoc xml DECLARE @ProdID varchar(max) SET @myDoc = ‘<ExportProjectDetailsMessage xmlns:i=”http://www.w3.org/2001/XMLSchema-instance” xmlns=”http://schemas.datacontract.org/2004/07/Project”><CPProjectId>7665699f-6772-424c-8b7b-405b9220a8e7</CPProjectId></ExportProjectDetailsMessage>’ SET @ProdID = @myDoc.value(‘(ExportProjectDetailsMessage/CPProjectId)[1]’, ‘varchar(max)’ ) SELECT @ProdID All i can receive is NULL =/ I’ve tried many combinations… Read More »

XML Schema – How can I change the name of a ref'ed element?

Questions: I’m an XML Schema noob, and this is my first Stack Overflow question. Please forgive my ignorance of standards and etiquette in both. In an XML Schema file (.xsd), I’m including another schema (outside of my control) that represents a sort of de facto standard my group is using. Within the external schema is… Read More »

Parsing malformed/incomplete/invalid XML files [duplicate]

Questions: This question already has an answer here: How to parse invalid (bad / not well-formed) XML? 2 answers Answers: You could try to use JSoup to parse the invalid XML. By definition XML should be well-formed, otherwise it’s invalid and should not be used. UPDATE – example: public static void main(String[] args) { for… Read More »

Is there a way to getElement xml by attribute?

Questions: I’m trying to grab an xml node by its attribute. edit I’m trying to retrieve an element by its attribute value using javascript xml instead of jquery. Is there a simple method for this? Answers: You have to find a list of elements first, then filter by their attributes. Check out my demo here:… Read More »

Getting encoding type of a XML in java

Questions: I am parsing XML using DocumentBuilder in java 1.4. XML has first line as xml version=”1.0″ encoding=”GBK” I want to get encoding type of the XML and use it. How can I get “GBK” Basically i will be making one more XML where i want encoding=”GBK” to be retained. Currently it is getting lost… Read More »

Updating XML files using PowerShell

Questions: I’m using PowerShell to update an XML directory listing for an application across a number of servers but having an issue making the actual updates. Using the following XML as an example, looking to update the filepaths with qualnas1 to use something like \GlobalNAS…etc and remove the qualnas2 entry. <?xml version=”1.0″ encoding=”UTF-8″ ?> <directory>… Read More »

What does node()|@* mean XSLT?

Questions: I have seen this being used in this contect: <xsl:template match=”node()|@*”> <xsl:copy> <xsl:apply-templates select=”node()|@*”/> </xsl:copy> Can anyone explain that the “node()|@*” means? Answers: This is called the identity transform. The node()|@* is matching all child nodes (node() is all text,element,processing instructions,comments) and attributes (@*) of the current context.

TextView Hyperlink is not working?

Questions: Why TextView Hyperlink is not working. Using hyperlink as inside the custom dialog box. The hyperlink is not appear. Where i am mistaken. How do solve it. Give me guidance. XML code is <TextView android:id=”@+id/google_Link” android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:layout_gravity=”center” android:gravity=”center” android:padding=”10dip” android:textSize=”20dip” android:linksClickable=”true” android:autoLink=”all” android:textColorLink=”#306EFF” android:text=”” /> Android Code is TextView googleLink = ( TextView… Read More »