does anybody here know what is my xml problem? <?xml version="1.0" encoding="UTF-8"?>
<LayerDefinition xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="LayerDefinition-1.1.0.xsd" version="1.1.0"> <VectorLayerDefinition> <ResourceId>Library://UPM/Data/BUILD_BUILD_region.FeatureSource</ResourceId> <FeatureName>Default:BUILD_BUILD_region</FeatureName> <FeatureNameType>FeatureClass</FeatureNameType> <PropertyMapping> <Name>NAME</Name> <Value>NAME</Value> </PropertyMapping> <Geometry>Geometry</Geometry> <Url>concat('http://128.88.31.35:8008/mapguide/UPM/phpscripts/bom/activeWR.php?bl_id=', "ID")</Url> <VectorScaleRange> <MaxScale>6958.1596415586</MaxScale> <AreaTypeStyle> <AreaRule> <Filter>FeatId > 10</Filter> <LegendLabel></LegendLabel> <Label> <Unit>Inches</Unit> <SizeContext>DeviceUnits</SizeContext> <SizeX>0.3</SizeX> <SizeY>0.118110236220472</SizeY> <Rotation>0.0</Rotation> <Text>"NAME"</Text> <FontName>Arial Black</FontName> <ForegroundColor>H0H0H0H</ForegroundColor> <BackgroundColor>HHHHHHH</BackgroundColor> <BackgroundStyle>Ghosted</BackgroundStyle> <HorizontalAlignment>'Center'</HorizontalAlignment> <VerticalAlignment>Halfline</VerticalAlignment> <Bold>true</Bold> </Label> <AreaSymbolization2D> <Fill> <FillPattern>Net_45</FillPattern> <ForegroundColor>H0H0H0H</ForegroundColor> <BackgroundColor>HHHHHHH</BackgroundColor> </Fill> <Stroke> <LineStyle>Solid</LineStyle> <Thickness>0.0</Thickness> <Color>FF000000</Color> <Unit>Centimeters</Unit> <SizeContext>DeviceUnits</SizeContext> </Stroke> </AreaSymbolization2D> </AreaRule> </AreaTypeStyle> </VectorScaleRange> <VectorScaleRange> <MinScale>6958.1596415586</MinScale> <AreaTypeStyle> <AreaRule> <LegendLabel></LegendLabel> <AreaSymbolization2D> <Fill> <FillPattern>Net_45</FillPattern> <ForegroundColor>H0H0H0H</ForegroundColor> <BackgroundColor>HHHHHHH</BackgroundColor> </Fill> <Stroke> <LineStyle>Solid</LineStyle> <Thickness>0</Thickness> <Color>ff666666</Color> <Unit>Inches</Unit> <SizeContext>DeviceUnits</SizeContext> </Stroke> </AreaSymbolization2D> </AreaRule> </AreaTypeStyle> </VectorScaleRange> </VectorLayerDefinition> </LayerDefinition> i create this xml from mapguide studio. i intend to create a new layer programatically using this xml file that calling from change_layers_via_dom.php code sample. what i do here is changed DOMDocument::Load to load my xml file and also change a node value that satisfy my query. $domDocument = DOMDocument::load('RecentlyBuilt.LayerDefinition.xml'); if ($domDocument == NULL) { echo "The layer definition 'RecentlyBuilt.LayerDefinition' could not be found.<BR>\n"; return; } // Change the filter $xpath = new DOMXPath($domDocument); $query = '//AreaRule/Filter'; // Get a list of all the <AreaRule><Filter> elements in the XML. $nodes = $xpath->query($query); // Find the correct node and change it foreach ($nodes as $node ) { if ($node->nodeValue == 'FeatId > 10') { $node->nodeValue = 'FeatId > 10'; } } // Change the legend label $query = '//LegendLabel'; // Get a list of all the <LegendLabel> elements in the // XML. $nodes = $xpath->query($query); // Find the correct node and change it foreach ($nodes as $node ) { if ($node->nodeValue == 'FeatId > 10') { $node->nodeValue = 'FeatId > 10'; } } // --------------------------------------------------// // ... // Add the layer to the map $layerDefinition = $domDocument->saveXML(); $newLayer = add_layer_definition_to_map($layerDefinition, "RecentlyBuilt", "FeatId > 10", $sessionId, $resourceService, $map); add_layer_to_group($newLayer, "Analysis", "Analysis", $map); // --------------------------------------------------// // Turn off the "Square Footage" themed layer (if it // exists) so it does not hide this layer. $layerCollection = $map->GetLayers(); if ($layerCollection->Contains("SquareFootage")) { $squareFootageLayer = $layerCollection->GetItem("SquareFootage"); $squareFootageLayer->SetVisible(false); } // --------------------------------------------------// // Turn on the visibility of this layer. // (If the layer does not already exist in the map, it will be visible by default when it is added. // But if the user has already run this script, he or she may have set the layer to be invisible.) $layerCollection = $map->GetLayers(); if ($layerCollection->Contains("RecentlyBuilt")) { $recentlyBuiltLayer = $layerCollection->GetItem("RecentlyBuilt"); $recentlyBuiltLayer->SetVisible(true); } Once i ran the code, there is nothing happened. then i copy the link to new browser, but it show this error message ERROR: The new XML document is invalid. Can you tell me what is my problem? -- View this message in context: http://n2.nabble.com/invalid-XML-document-tp2149327p2149327.html Sent from the MapGuide Users mailing list archive at Nabble.com. _______________________________________________ mapguide-users mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/mapguide-users
