wwXML::GetObjVar

Retrieves an element value from a tag expression in an XML document.

Assumes the XML document is a simple single 'record' object. In this case native code extracts the value of an XML item. Note: Only a single entry for the element searched for should exist. If multiple objects exist only the first instance is returned.

This method is meant as a light weight method to retrieve XML elements without requiring the XML parser and works well for objects persisted to XML as well as any other XML document that uniquely guarantees unique tag names.

o.GetObjVar(lcItem,lcXMLDoc)

Return Value

Value of the item as a string or "" if not found or empty.

If key's not found "" is returned. If the the key is empty "" is returned as well.

Parameters

lcItem
The key of the item to retrieve.

lcXMLDoc
Optional - XML document to retrieve value from. The default is the
current document as exposed by cBody, but you can pass in a document to parse.

Remarks

I created this method for simple parsing when I know that all XML elements are unique and only a single 'object' group exists. Mainly, used for quick parsing of an object converted into XML

Not recommended for use on complex XML documents. You must use a parser if more than one object with duplicate element names exist.


See also:

Class wwXML (High Level Methods)

© West Wind Technologies, 2023 • Updated: 12/17/99
Comment or report problem with topic